package com.ch.ch7_2.controller;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import com.ch.ch7_2.model.Book;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class ThymeleafController {
    @GetMapping("/")
    public String index(Model model) {
        Book teacherGeng = new Book(
                "9787302629443",59.8,
                "Vue.js 3.x从入门到实战（微课视频版）",
                "清华大学出版社","陈恒","093127-01.jpg"
        );
        List<Book> chenHeng = new ArrayList<Book>();
        Book b1 = new Book(
                "9787302529118", 69.8,
                "Java Web开发从入门到实战（微课版）",
                "清华大学出版社", "陈恒","082526-01.jpg"
        );
        chenHeng.add(b1);
        Book b2 = new Book(
                "9787302651192", 59.8,
                "Java EE框架整合开发入门到实战——Spring+Spring MVC+MyBatis（第2版·微课视频）",
                "清华大学出版社", "陈恒","101137-01.jpg");
        chenHeng.add(b2);
        model.addAttribute("aBook", teacherGeng);
        model.addAttribute("books", chenHeng);
        return "index";
    }
}
